#ifndef QQMUSIC_H
#define QQMUSIC_H

#include <QWidget>
#include"musiclist.h"
#include<QMediaPlayer>
#include<QMediaPlaylist>
#include"commen.h"
#include"lrcpage.h"
#include<QPropertyAnimation>
#include<QSqlDatabase>
#include<QSqlError>
QT_BEGIN_NAMESPACE
namespace Ui { class QQMusic; }
QT_END_NAMESPACE

class QQMusic : public QWidget
{
    Q_OBJECT

public:
    QQMusic(QWidget *parent = nullptr);
    void InitUI();
    void InitsqlLite();
    void InitMusicList();
    void mousePressEvent(QMouseEvent* event);
    void mouseMoveEvent(QMouseEvent* event);
    void onUpdateLikeMusic(bool isLike, QString musicId);
    QJsonArray randompropation();
    void Connectform();
    void PlayOnMusic();
    void Initplayer();
    void onPlayClicked();
    void onPlayChangedStatus();
    void OnPlayUpMusic();
    void OnPlayDownMusic();
    void OnPlayBackMode();
    void OnPlayBackModeChanged(QMediaPlaylist::PlaybackMode playbackmode);
    void OnPlayAll(PageType pagetype);
    void playAllCommenPage(Commen* commenpage,int index);
    void playMusicByIndex(Commen* page,int index);
    void onCurrentIndexChanged(int index);
    void setMusicSilence(bool isMute);
    void setplayerVolume(int Volume);
    void onPlayDurationChange(qint64 duration);
    void onPositionChange(qint64 position);
    void onSliderpositionChange(float value);
    void onMetaDataAvailableChangedChanged(bool available);
    void onLrcWordClicked();
    ~QQMusic();

private:
    Ui::QQMusic *ui;
    QMediaPlayer* fg;
    QMediaPlaylist* gh;
    Commen* currentpage;
    int currentindex;
    qint64 totaltime;
    LrcPage* lrcPage;
    QPropertyAnimation* animation;
    QSqlDatabase sqlite;
protected:
    QPoint distance;
    MusicList musicList;
private slots:
    void on_quit_clicked();
    void onbtClick(int pageid);
    void on_pushButton_5_clicked();
    void on_pushButton_6_clicked();
};
#endif // QQMUSIC_H
